package net.ibizsys.model.util.transpiler.wf;



import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import net.ibizsys.model.IPSModelObject;
import net.ibizsys.model.util.transpiler.IPSModelListTranspiler;
import net.ibizsys.model.util.transpiler.IPSModelTranspileContext;
import net.ibizsys.model.util.transpiler.IPSModelTranspiler;
import net.ibizsys.psmodel.core.util.IPSModel;

public class PSWFLinkListTranspiler extends net.ibizsys.model.util.transpiler.PSModelListTranspilerBase{

	@Override
	protected net.ibizsys.psmodel.core.domain.PSWFLink createDomain(IPSModelObject iPSModelObject) throws Exception{
		return new net.ibizsys.psmodel.core.domain.PSWFLink();
	}

	protected IPSModelTranspiler getPSModelTranspiler(IPSModelTranspileContext iPSModelTranspileContext, Object type) throws Exception {
		String strTypeValue = (type == null)?"":type.toString();
		switch(strTypeValue){
			case "IAACTION":
				return iPSModelTranspileContext.getPSModelTranspiler(net.ibizsys.model.wf.PSWFInteractiveLinkImpl.class, false);
			case "ROUTE":
				return iPSModelTranspileContext.getPSModelTranspiler(net.ibizsys.model.wf.PSWFRouteLinkImpl.class, false);
			case "TIMEOUT":
				return iPSModelTranspileContext.getPSModelTranspiler(net.ibizsys.model.wf.PSWFTimeoutLinkImpl.class, false);
			case "WFRETURN":
				return iPSModelTranspileContext.getPSModelTranspiler(net.ibizsys.model.wf.PSWFEmbedWFReturnLinkImpl.class, false);
			default:
				return iPSModelTranspileContext.getPSModelTranspiler(net.ibizsys.model.wf.PSWFLinkImpl.class, false);
		}
	}
	
	@Override
	protected IPSModelTranspiler getPSModelTranspiler(IPSModelTranspileContext iPSModelTranspileContext, IPSModelObject iPSModelObject) throws Exception {
		net.ibizsys.model.wf.IPSWFLink iPSWFLink = (net.ibizsys.model.wf.IPSWFLink)iPSModelObject;
		Object type = iPSWFLink.getWFLinkType();
		return getPSModelTranspiler(iPSModelTranspileContext, type);
	}
	
	@Override
	protected IPSModelTranspiler getPSModelTranspiler(IPSModelTranspileContext iPSModelTranspileContext, IPSModel domain) throws Exception {
		Object type = domain.get("wflinktype");
		return getPSModelTranspiler(iPSModelTranspileContext, type);
	}
}